package com.tangsm.spring.boot.filter.common.utli;

import org.apache.commons.lang3.StringUtils;
import org.springframework.http.MediaType;

import javax.servlet.ServletRequest;

/**
 * http工具类
 * @author tangsm
 */
public class HttpUtils {

    /**
     * 判断是否是Json请求
     * @param request 客户端请求信息
     * @return 是否
     */
    public static boolean isJsonContent(ServletRequest request) {
        String contentType = request.getContentType();
        return StringUtils.isNotBlank(contentType) && contentType.contains(MediaType.APPLICATION_JSON_VALUE);
    }
}
